<?php
 /*Template Name: All Project Category
 */
 
//Get Project Categories
$categories = get_project_categories();


get_header(); ?>

<div class="container" id="top_info">
	<div class="top-content">&nbsp;</div>
    <div class="top-curve">&nbsp;</div>
</div>


<div class="container">
	<div class="page-slider-wrapper">
    <div class="page-slider">
        <div class="slide active">
        	<img src="<?php bloginfo('template_directory'); ?>/images/temp/htl1.jpg" alt="image1" />
        </div>
        <div class="slide">
        	<img src="<?php bloginfo('template_directory'); ?>/images/temp/htl2.jpg" alt="image2" />
        </div>
        <div class="slide">
        	<img src="<?php bloginfo('template_directory'); ?>/images/temp/htl3.jpg" alt="image3" />
        </div>
        
    </div>
    <div class="slider-text">
        <div class="title">Projects</div>
     	<div class="desc">&nbsp;</div>
    </div>
    </div>
    
    <div class="page-content">
   	
    
    	<?php foreach($categories as $cat): ?>
    	<div class="proj-cat">
       		<h3><?php echo $cat->name; ?></h3>
			<div class="proj-desc"><?php echo $cat->description; ?></div>
			<div class="clear">&nbsp;</div>
            <?php 
				$query = get_project_category_posts('dmci_projects', 'dmci_project_categories', $cat->slug, 1);
				while ( $query->have_posts() ) :
					$query->the_post();
				?>
                <div class="info">
                        <a href="<?php echo the_permalink()?>" class="img-link">
                        	<img src="<?php bloginfo('template_directory'); ?>/images/temp/htl2.jpg" alt="image2" />
                        </a>
                        <p>
                            <strong><?php echo the_title(); ?></strong>
                           <?php
						   		//REmove <p> tag from the excerpty
								$the_content = get_the_content();

								echo substr(strip_tags($the_content), 0, 250) . ' [...]';
						   ?>
                           <br/>
                            <a href="<?php echo the_permalink(); ?>">Explore Project</a>
                        </p>
                        <div class="clear">&nbsp;</div>
                    </div>   
                <?php	endwhile; ?>
               	<ul class="listings">
                	<?php 
					$query = get_project_category_posts('dmci_projects', 'dmci_project_categories', $cat->slug);
					$ctr = 0;
					while ( $query->have_posts() ) :
						$query->the_post();
					?>
                    <?php if( $ctr > 0) : ?>
					<li><a href="<?php the_permalink(); ?>"><span class="arrow">&gt;</span><?php the_title(); ?></a></li>
                    <?php 
						endif; 
						$ctr++;
					
					?>
                    <?php endwhile; ?>
                </ul>
                <div class="clear">&nbsp;</div>
        </div>
        <?php 
			endforeach;
			wp_reset_postdata();
		?>
        
  		
    </div>
   
</div>




<?php wp_reset_query(); ?>
<?php get_footer(); ?>